<?php 
if(isset($_GET['acts']) && $_GET['acts']==100)
{
	$_SESSION['IS_LOGIN'] = null;
	wp_redirect(WP_MYSITE_URL);
}	
$luotxem = count($_SESSION[$sessionID]['current-views']);

$uploaddir = wp_upload_dir();
$logo = WP_MYSITE_TEMPLATE_URL.'/images/logo.png';
$mylogo = get_option("company_setting_logo");
if($mylogo)
{
	$logo = $uploaddir['baseurl'].$mylogo;
}
?>
<div class="header">
<input type="hidden" name="hidden_myurl_request" id="hidden_myurl_request" value="<?php echo WP_MYSITE_URL;?>/process-request">
<input type="hidden" name="hidden_myurl_home_page" id="hidden_myurl_home_page" value="<?php echo WP_MYSITE_URL;?>">
      <h2>
      	<a href="<?php echo WP_MYSITE_URL;?>">
      		<img src="<?php echo $logo; ?>" alt="<?php echo WP_MYSITE_DESCRIPTION;?>" />
      	</a>
      </h2>
      <div class="header_right">
        <div class="login">
          <div id="myslidemenu" class="jqueryslidemenu">
            <!--menu -->
            <ul>
              <?php 
              if(isset($_SESSION['IS_LOGIN']) && $_SESSION['IS_LOGIN']!=null)
              {
              	 echo '<li style="color:#005FA2; padding:5px; font-weight:normal;">Xin Chào : <b>'.$_SESSION['IS_LOGIN']['username'].'</b></li>';
              	 echo '<li style="color:#005FA2; padding:5px; font-weight:normal;"> <a href="'.WP_MYSITE_URL.'?acts=100" style="padding:0 5px; text-decoration:underline;" ><b> Thoát </b></a></li>';
              }
              else 
              {
              ?>	
              <li><a href="#" class="dk">Đăng ký</a></li>
              <li><a href="#" class="dn">Đăng nhập</a></li>
              <?php 
              }
              ?>
              <li class="last"><a style="padding-right: 20px;" href="#"><?php echo $luotxem;?> Lượt xem sản phẩm
              
              </a>
              <?php 
              if($luotxem>0)
              {
              ?>
              	
                <ul>                
                <?php 
                if($_SESSION[$sessionID]['current-views'])
                {
                	$post_id='';
                	$id=1;
                	for($i=$luotxem-1 ; $i>=0 ;$i--)
                	{
                			$post_id = $_SESSION[$sessionID]['current-views'][$i];
                			$perlink = get_permalink($post_id);
                			$title = get_the_title($post_id);
                			$thumbnail = db_get_post_meta($post_id, $wpdb->prefix.'thumbnail');
                			$alt = db_get_alt_attachment_id($post_id, $wpdb->prefix.'thumbnail');
                			if(!$alt)
                				$alt = db_vietnamese_slug($title);
                			$dientichsudung = get_post_meta($post_id,$wpdb->prefix.'dien-tich-su-dung',true);
                			$price = get_post_meta($post_id,$wpdb->prefix.'price',true);
                			//$image_rs = new SimpleImage();
							//if($thumbnail)
								//$thumbnail = db_resizeImage($image_rs, $thumbnail, 60, 58);
							$donvigia = get_post_meta($post_id,$wpdb->prefix.'don-vi-gia',true);
                			?>
                			<li><a href="<?php echo $perlink;?>">
			                    <div class="swap">
			                      <div class="i_hinh">
			                      	<img src="<?php bloginfo('stylesheet_directory'); ?>/timthumb.php?src=<?php echo $thumbnail;?>&w=60&h=58" border="0" " alt="<?php echo $alt;?>"/>
			                      </div>
			                      <div class="info_h">
			                        <p><?php echo db_shortDesc($title, 40);?></p>
			                        <p>DTSD: <?php echo $dientichsudung;?>.</p>
			                        <p>Giá: <?php echo db_process_price_bds($price, 1,$donvigia);?></p>
			                      </div>
			                    </div>
			                    </a>
			                 </li>
                			<?php 
                			$id++;
                	 
                		
                	}
                }
                ?> 
                <!--                
                   <div class="dn_luot_xem">
                   	<a href="" class="dk"><img src="<?php echo WP_MYSITE_TEMPLATE_URL;?>/images/dk.jpg" alt="" /></a>
                   	<a href="#" class="dn"><img src="<?php echo WP_MYSITE_TEMPLATE_URL;?>/images/dn.jpg" alt="" /></a>
                   </div>
               -->                      
                </ul>
                
                
              </li>
              
              
            </ul>
            <?php }?>
            <br style="clear: left" />
          </div>
          <!--end menu -->
        </div>
        <!-- end .login-->
        <div class="clr"></div>
        <div class="menu"> 
	        <div class="face">
	          <ul>
	            <li style="width: 70px; overflow: hidden;">
	            	<div class="fb-like" data-send="false" data-layout="button_count" data-width="450" data-show-faces="true"></div>
	            </li>
	            <li>
	            <!-- Place this tag where you want the +1 button to render. -->
					<div class="g-plusone" data-annotation="none"></div>
	            </li>
	          </ul>
	          </div>
          
          <ul>
          	<!-- 
            <li class="active"><a href="<?php echo WP_MYSITE_URL;?>/cho-thue">Cho thuê</a></li>
            <li><a href="<?php echo WP_MYSITE_URL;?>/can-ban">Cần bán</a></li>
            <li><a href="<?php echo WP_MYSITE_URL;?>/ky-gui">Ký gửi</a></li>
            -->
            <?php wp_nav_menu( array('menu' => 'top_menu' )); ?>
          </ul>
          <div class="clr"></div>
        </div>
        <!-- end .menu-->
      </div>
      <!-- end .header_right-->
    </div>
   <?php require_once TEMPLATEPATH.'/controllers/isset-page.php';?> 